package com.xxx.mapper;

import com.xxx.pojo.ClassInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ClassInfoMapper {

    @Insert("insert into class values (#{types}, #{typesName},  #{order}, #{createTime}, #{updateTime}, #{createUser}, #{updateUser})")
    int addClassInfo(ClassInfo classInfo);

    @Select("select * from class")
    @ResultMap("classInfoResultMap")
    List<ClassInfo> selectAll();


    @Select("select * from class where types_name = #{typesName}")
    @ResultMap("classInfoResultMap")
    ClassInfo selectAllByTypesName(String typesName);

    @Delete("delete from class where class.order = #{order};")
    int delByOrder(Long order);

    @Update("update class set types = #{types},types_name = #{typesName},up_time = #{updateTime},update_user = #{updateUser} where class.order = #{order};")
    int updateClassInfo(ClassInfo classInfo);

    @Select("select * from class where class.order= #{order} ;")
    @ResultMap("classInfoResultMap")
    ClassInfo selectByOrder(Long order);
}
